﻿using Abp.AutoMapper;
using Abp.Modules;
using Abp.Reflection.Extensions;
using Choucius.Boilerplate9.Authorization;

namespace Choucius.Boilerplate9
{
    [DependsOn(
        typeof(Boilerplate9CoreModule), 
        typeof(AbpAutoMapperModule))]
    public class Boilerplate9ApplicationModule : AbpModule
    {
        public override void PreInitialize()
        {
            Configuration.Authorization.Providers.Add<Boilerplate9AuthorizationProvider>();

            // 配置Quartz作业
            //Configuration.BackgroundJobs.UseQuartz();
        }

        public override void Initialize()
        {
            var thisAssembly = typeof(Boilerplate9ApplicationModule).GetAssembly();

            IocManager.RegisterAssemblyByConvention(thisAssembly);

            Configuration.Modules.AbpAutoMapper().Configurators.Add(
                // Scan the assembly for classes which inherit from AutoMapper.Profile
                cfg => cfg.AddMaps(thisAssembly)
            );
        }

        public override void PostInitialize()
        {
        }
    }
}
